# -*- coding: utf-8 -*-

import unittest
import os.path

from kivy.lang import Builder

from before_round_screen import BeforeRoundScreen
from presenter_mock import PresenterMock
from model.gamestate import *


class BeforeRoundScreenTest(unittest.TestCase):
    def setUp(self):
        Builder.load_file(os.path.join(os.path.dirname(__file__),
                                       'beforeroundscreen.kv'))
        self.gamestate = GameState(Players([]), Hat([]),
                                   GameRound(0, [], '', (None, None)),
                                   Phase.BEFORE_ROUND, [], Player('', []),
                                   Settings(10, 20, 1000))
        self.presenter = PresenterMock(Phase.GUESS_WORD)

    def test_timeout(self):
        widget = BeforeRoundScreen(self.gamestate, self.presenter)
        self.assertEquals(self.presenter.is_phase_changed, False)
        widget.update(10000)
        self.assertEquals(self.presenter.is_phase_changed, True)


if __name__ == '__main__':
    unittest.main()
